﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using Noris.Tools.FrxEditor.Editor;
using System.Windows.Forms;

namespace Noris.Tools.FrxEditor.Components
{
    /// <summary>
    /// Třída, která v sobě zahrnuje metody pro obecné renderování controlů na základě jejich zadání a stavu.
    /// </summary>
    public static class UiRenderer
    {
        #region DrawBackground
        /// <summary>
		/// Vykreslí pozadí daným stylem
		/// </summary>
		/// <param name="graphics"></param>
		/// <param name="area"></param>
		/// <param name="backColor"></param>
		/// <param name="colorShift"></param>
		/// <param name="renderStyle"></param>
		/// <param name="mouseState"></param>
		public static void DrawBackground(Graphics graphics, RectangleF area, Color backColor, int colorShift, RenderStyle renderStyle, EditMouseState mouseState)
		{
            if (area.Width > 0f && area.Height > 0f)
            {
                switch (renderStyle)
                {
                    case RenderStyle.FlatStyle:
                    case RenderStyle.ProfessionalStyle:
                    case RenderStyle.WinXpStyle:
                    case RenderStyle.Win7Style:
                        DrawBackgroundInStyle(graphics, area, backColor, colorShift, renderStyle, mouseState);
                        break;
                    case RenderStyle.HorizontalHeader:
                        DrawBackgroundHorizontalHeader(graphics, area, backColor, colorShift, renderStyle, mouseState);
                        break;
                    default:
                        DrawBackgroundInStyle(graphics, area, backColor, colorShift, RenderStyle.FlatStyle, mouseState);
                        break;
                }
            }
		}
        /// <summary>
        /// Vykreslí pozadí podle daného stylu, jednorázově daným ColorBlendem
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="area"></param>
        /// <param name="backColor"></param>
        /// <param name="colorShift"></param>
        /// <param name="renderStyle"></param>
        /// <param name="mouseState"></param>
        private static void DrawBackgroundInStyle(Graphics graphics, RectangleF area, Color backColor, int colorShift, RenderStyle renderStyle, EditMouseState mouseState)
        {
            using (LinearGradientBrush lgb = new LinearGradientBrush(area, backColor, backColor, 90f))
            {
                lgb.InterpolationColors = GetColorBlend(backColor, colorShift, renderStyle, mouseState);
                graphics.FillRectangle(lgb, area);
            }
        }
        /// <summary>
        /// Vykreslí pozadí podle daného stylu, 3x horizontálně
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="area"></param>
        /// <param name="backColor"></param>
        /// <param name="colorShift"></param>
        /// <param name="renderStyle"></param>
        /// <param name="mouseState"></param>
        private static void DrawBackgroundHorizontalHeader(Graphics graphics, RectangleF area, Color backColor, int colorShift, RenderStyle renderStyle, EditMouseState mouseState)
        {
            float height = (float)Math.Round(area.Height,0);
            float heigh1 = (height > 10f ? 4f : height / 3f);
            float heigh3 = (height > 10f ? 4f : height / 3f);
            float heigh2 = height - heigh1 - heigh3;
            int shift = 25;

            Color color = backColor;
            switch (mouseState)
            {
                case EditMouseState.OnControl:
                    color = color.Shift(-10, -10, 0);
                    break;
                case EditMouseState.MouseLeftDown:
                case EditMouseState.MouseRightDown:
                    color = color.Shift(-20, -10, -10);
                    shift = -25;
                    break;
            }

            RectangleF top = new RectangleF(area.X, area.Y, area.Width, heigh1);
            using (LinearGradientBrush lgb = new LinearGradientBrush(top, color.Shift(+shift), color, 90f))
            {
                graphics.FillRectangle(lgb, top);
            }
            RectangleF mid = new RectangleF(area.X, area.Y + heigh1, area.Width, heigh2);
            using (SolidBrush slb = new SolidBrush(color))
            {
                graphics.FillRectangle(slb, mid);
            }
            RectangleF bot = new RectangleF(area.X, area.Y + heigh1 + heigh2, area.Width, heigh3);
            using (LinearGradientBrush lgb = new LinearGradientBrush(bot, color, color.Shift(-2 * shift), 90f))
            {
                graphics.FillRectangle(lgb, bot);
            }
        }
		#endregion
		#region DrawBorder
		/// <summary>
		/// Vykreslí rámeček do specifikovaného prostoru
		/// </summary>
		/// <param name="graphics">Grafika</param>
		/// <param name="rectangle">Prostor</param>
		public static void DrawBorder(Graphics graphics, Rectangle rectangle)
		{
			DrawBorder(graphics, rectangle.Location, rectangle.Size, BorderStyle.Fixed3D, Border3DSide.All);
		}
		/// <summary>
		/// Vykreslí rámeček okolo celého předaného controlu
		/// </summary>
		/// <param name="graphics">Grafika</param>
		/// <param name="begin">Počátek</param>
		/// <param name="size">Velikost</param>
		public static void DrawBorder(Graphics graphics, Point begin, Size size)
		{
			DrawBorder(graphics, begin, size, BorderStyle.Fixed3D, Border3DSide.All);
		}
		/// <summary>
		/// Vykreslí rámeček okolo celého předaného controlu, v daném stylu
		/// </summary>
		/// <param name="graphics">Grafika</param>
		/// <param name="begin">Počátek</param>
		/// <param name="size">Velikost</param>
		/// <param name="borderStyle">Styl borderu, default = BorderStyle.Fixed3D</param>
		public static void DrawBorder(Graphics graphics, Point begin, Size size, BorderStyle borderStyle)
		{
			DrawBorder(graphics, begin, size, borderStyle, Border3DSide.All);
		}
		/// <summary>
		/// Vykreslí rámeček okolo celého předaného controlu, v daném stylu
		/// </summary>
		/// <param name="graphics">Grafika</param>
		/// <param name="begin">Počátek</param>
		/// <param name="size">Velikost</param>
		/// <param name="borderStyle">Styl borderu, default = BorderStyle.Fixed3D</param>
		/// <param name="borderSide">Kreslené okraje borderu, default = Border3DSide.All</param>
		public static void DrawBorder(Graphics graphics, Point begin, Size size, BorderStyle borderStyle, Border3DSide borderSide)
		{
			if (borderStyle == BorderStyle.None) return;
			Point target = new Point(begin.X + size.Width - 1, begin.Y + size.Height - 1);
			Color controlColor = SystemColors.ControlDark;
			using (Pen border = new Pen(controlColor, 1F))
			{
				switch (borderStyle)
				{
					case BorderStyle.FixedSingle:
						border.Color = Color.Black;
						graphics.DrawRectangle(border, begin.X, begin.Y, size.Width - 1, size.Height - 1);
						break;
					case BorderStyle.Fixed3D:
						border.Color = SystemColors.ControlDark;
						graphics.DrawLine(border, begin.X, begin.Y, target.X - 1, begin.Y);                 // Vnější horní čára
						graphics.DrawLine(border, begin.X, begin.Y, begin.X, target.Y - 1);                 // Vnější levá čára
						border.Color = SystemColors.ControlDarkDark;
						graphics.DrawLine(border, begin.X + 1, begin.Y + 1, target.X - 2, begin.Y + 1);     // Vnitřní horní čára
						graphics.DrawLine(border, begin.X + 1, begin.Y + 1, begin.X + 1, target.Y - 2);     // Vnitřní levá čára
						border.Color = SystemColors.ControlLightLight;
						graphics.DrawLine(border, target.X, begin.Y, target.X, target.Y);                   // Vnější pravá čára
						graphics.DrawLine(border, begin.X, target.Y, target.X, target.Y);                   // Vnější dolní čára
						border.Color = SystemColors.Control;
						graphics.DrawLine(border, target.X - 1, begin.Y + 1, target.X - 1, target.Y - 1);   // Vnitřní pravá čára
						graphics.DrawLine(border, begin.X + 1, target.Y - 1, target.X - 1, target.Y - 1);   // Vnitřní dolní čára
						break;
				}
			}
		}
		#endregion
		#region DrawString; AlignSizeIntoArea
		/// <summary>
		/// Do daného prostoru vepíše text, se zarovnáním
		/// </summary>
		/// <param name="graphics"></param>
		/// <param name="text"></param>
		/// <param name="font"></param>
		/// <param name="brush"></param>
		/// <param name="textArea"></param>
		/// <param name="alignment"></param>
		public static void DrawString(Graphics graphics, string text, Font font, Brush brush, Rectangle textArea, ContentAlignment alignment)
		{
            StringFormatFlags stringFormat = StringFormatFlags.LineLimit | StringFormatFlags.NoWrap;
			DrawString(graphics, text, font, brush, textArea, alignment, stringFormat);
		}
		/// <summary>
		/// Do daného prostoru vepíše text, se zarovnáním
		/// </summary>
		/// <param name="graphics"></param>
		/// <param name="text"></param>
		/// <param name="font"></param>
		/// <param name="brush"></param>
		/// <param name="textArea"></param>
		/// <param name="alignment"></param>
        public static void DrawString(Graphics graphics, string text, Font font, Brush brush, RectangleF textArea, ContentAlignment alignment)
		{
			StringFormatFlags stringFormat = StringFormatFlags.LineLimit | StringFormatFlags.NoWrap;
            DrawString(graphics, text, font, brush, Rectangle.Round(textArea), alignment, stringFormat);
		}
        /// <summary>
        /// Do daného prostoru vepíše text, se zarovnáním
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="text"></param>
        /// <param name="font"></param>
        /// <param name="foreColor"></param>
        /// <param name="textArea"></param>
        /// <param name="alignment"></param>
        public static void DrawString(Graphics graphics, string text, Font font, Color foreColor, Rectangle textArea, ContentAlignment alignment)
        {
            StringFormatFlags stringFormat = StringFormatFlags.LineLimit | StringFormatFlags.NoWrap;
            DrawString(graphics, text, font, foreColor, textArea, alignment, stringFormat);
        }
        /// <summary>
        /// Do daného prostoru vepíše text, se zarovnáním
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="text"></param>
        /// <param name="font"></param>
        /// <param name="foreColor"></param>
        /// <param name="textArea"></param>
        /// <param name="alignment"></param>
        public static void DrawString(Graphics graphics, string text, Font font, Color foreColor, RectangleF textArea, ContentAlignment alignment)
        {
            StringFormatFlags stringFormat = StringFormatFlags.LineLimit | StringFormatFlags.NoWrap;
            DrawString(graphics, text, font, foreColor, Rectangle.Round(textArea), alignment, stringFormat);
        }
        /// <summary>
        /// Do daného prostoru vepíše text, se zarovnáním
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="text"></param>
        /// <param name="font"></param>
        /// <param name="foreColor"></param>
        /// <param name="textArea"></param>
        /// <param name="alignment"></param>
        /// <param name="stringFormat"></param>
        public static void DrawString(Graphics graphics, string text, Font font, Color foreColor, RectangleF textArea, ContentAlignment alignment, StringFormatFlags stringFormat)
        {
            DrawString(graphics, text, font, foreColor, Rectangle.Round(textArea), alignment, stringFormat);
        }
        /// <summary>
		/// Do daného prostoru vepíše text, se zarovnáním
		/// </summary>
		/// <param name="graphics"></param>
		/// <param name="text"></param>
		/// <param name="font"></param>
        /// <param name="foreColor"></param>
		/// <param name="textArea"></param>
		/// <param name="alignment"></param>
		/// <param name="stringFormat"></param>
        public static void DrawString(Graphics graphics, string text, Font font, Color foreColor, Rectangle textArea, ContentAlignment alignment, StringFormatFlags stringFormat)
        {
            using (Brush brush = new SolidBrush(foreColor))
            {
                DrawString(graphics, text, font, brush, textArea, alignment, stringFormat);
            }
        }
		/// <summary>
		/// Do daného prostoru vepíše text, se zarovnáním
		/// </summary>
		/// <param name="graphics"></param>
		/// <param name="text"></param>
		/// <param name="font"></param>
		/// <param name="brush"></param>
		/// <param name="textArea"></param>
		/// <param name="alignment"></param>
		/// <param name="stringFormat"></param>
		public static void DrawString(Graphics graphics, string text, Font font, Brush brush, Rectangle textArea, ContentAlignment alignment, StringFormatFlags stringFormat)
		{
            bool rend = true;
            if (!rend)
            {
                StringFormat format = new StringFormat(stringFormat);
                bool isVertical = ((stringFormat & StringFormatFlags.DirectionVertical) == StringFormatFlags.DirectionVertical);
                int textWidth = (isVertical ? textArea.Height : textArea.Width);
                SizeF textSize = graphics.MeasureString(text, font, textWidth, format);
                RectangleF alignArea = AlignSizeIntoArea(textArea, textSize, alignment);
                graphics.DrawString(text, font, brush, alignArea, format);
            }
            else
            {
                TextFormatFlags tff = GetFlags(alignment, true);
                TextRenderer.DrawText(graphics, text, font, textArea, Color.Black, tff);
            }
		}
        /// <summary>
        /// Sestaví a vrátí hodnotu TextFormatFlags (která slouží jako vstup pro renderer textu TextRenderer) na základě jednodušších vstupních hodnot.
        /// </summary>
        /// <param name="alignment">Zarovnání textu v jeho prostoru</param>
        /// <param name="multiLine">Víceřádkový text (text se zlomí mezi slovy)</param>
        /// <returns></returns>
        public static TextFormatFlags GetFlags(ContentAlignment alignment, bool multiLine)
        {
            TextFormatFlags flags = /* TextFormatFlags.NoClipping | */ TextFormatFlags.NoPrefix | TextFormatFlags.PreserveGraphicsClipping;

            switch (alignment)
            {
                case ContentAlignment.TopLeft:
                    flags |= TextFormatFlags.Top | TextFormatFlags.Left;
                    break;
                case ContentAlignment.TopCenter:
                    flags |= TextFormatFlags.Top | TextFormatFlags.HorizontalCenter;
                    break;
                case ContentAlignment.TopRight:
                    flags |= TextFormatFlags.Top | TextFormatFlags.Right;
                    break;
                case ContentAlignment.MiddleLeft:
                    flags |= TextFormatFlags.VerticalCenter | TextFormatFlags.Left;
                    break;
                case ContentAlignment.MiddleCenter:
                    flags |= TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter;
                    break;
                case ContentAlignment.MiddleRight:
                    flags |= TextFormatFlags.VerticalCenter | TextFormatFlags.Right;
                    break;
                case ContentAlignment.BottomLeft:
                    flags |= TextFormatFlags.Bottom | TextFormatFlags.Left;
                    break;
                case ContentAlignment.BottomCenter:
                    flags |= TextFormatFlags.Bottom | TextFormatFlags.HorizontalCenter;
                    break;
                case ContentAlignment.BottomRight:
                    flags |= TextFormatFlags.Bottom | TextFormatFlags.Right;
                    break;
            }

            if (!multiLine)
                flags |= TextFormatFlags.SingleLine;
            else
                flags |= TextFormatFlags.WordBreak;

            return flags;
        }
		/// <summary>
		/// Zarovná určitý prostor do daného prostoru v daném zarovnání.
		/// </summary>
		/// <param name="outerArea">Vnější prostor</param>
		/// <param name="innerSize">Vnitřní rámec</param>
		/// <param name="alignment">Styl zarovnání</param>
		/// <returns>Vnitřní rámec, zarovnaný do vnějšího prostoru</returns>
		public static RectangleF AlignSizeIntoArea(RectangleF outerArea, SizeF innerSize, ContentAlignment alignment)
		{
			// Zarovnání spočívá v určení pointu, kde se začne s psaním:
			PointF origin = outerArea.Location;
            SizeF textSize = innerSize;
            if (textSize.Width > outerArea.Width)
                textSize.Width = outerArea.Width;
            if (textSize.Height > outerArea.Height)
                textSize.Height = outerArea.Height;
			// Svisle:
			switch (alignment)
			{
				case ContentAlignment.TopLeft:
				case ContentAlignment.TopCenter:
				case ContentAlignment.TopRight:
					origin.Y = outerArea.Y;
					break;
				case ContentAlignment.MiddleLeft:
				case ContentAlignment.MiddleCenter:
				case ContentAlignment.MiddleRight:
					origin.Y = (outerArea.Y + 0.5F * (outerArea.Height - innerSize.Height));
					break;
				case ContentAlignment.BottomLeft:
				case ContentAlignment.BottomCenter:
				case ContentAlignment.BottomRight:
					origin.Y = (outerArea.Y + (outerArea.Height - innerSize.Height));
					break;
			}

			// Vodorovně:
			switch (alignment)
			{
				case ContentAlignment.TopLeft:
				case ContentAlignment.MiddleLeft:
				case ContentAlignment.BottomLeft:
					origin.X = outerArea.X;
					break;
				case ContentAlignment.TopCenter:
				case ContentAlignment.MiddleCenter:
				case ContentAlignment.BottomCenter:
					origin.X = (outerArea.X + 0.5F * (outerArea.Width - innerSize.Width));
					break;
				case ContentAlignment.TopRight:
				case ContentAlignment.MiddleRight:
				case ContentAlignment.BottomRight:
					origin.X = (outerArea.X + (outerArea.Width - innerSize.Width));
					break;
			}

            return new RectangleF(origin, textSize);
		}
		#endregion
		#region ColorBlend
		/// <summary>
		/// Vrátí objekt ColorBlend, který reprezentuje daný renderovací styl a stav myši (aktivitu objektu)
		/// </summary>
		/// <param name="colorRoot"></param>
		/// <param name="colorShift"></param>
		/// <param name="style"></param>
		/// <param name="state"></param>
		/// <returns></returns>
        public static ColorBlend GetColorBlend(Color colorRoot, int colorShift, RenderStyle style, EditMouseState state)
        {
            switch (style)
            {
                case RenderStyle.ProfessionalStyle:
                    return GetColorBlendProfessionalStyle(colorRoot, colorShift, state);
                case RenderStyle.WinXpStyle:
                    return GetColorBlendWinXpStyle(colorRoot, colorShift, state);
                case RenderStyle.Win7Style:
                    return GetColorBlendWin7Style(colorRoot, colorShift, state);
                case RenderStyle.FlatStyle:
                default:
                    return GetColorBlendFlatStyle(colorRoot, colorShift, state);
            }
        }
        private static ColorBlend GetColorBlendFlatStyle(Color colorRoot, float colorShift, EditMouseState state)
        {
            switch (state)
            {
                case EditMouseState.OnControl:
                case EditMouseState.MouseRightDown:
                    return new ColorBlend()
                    {
                        Positions = new float[] { 0f, 1f },
                        Colors = new Color[] { colorRoot.Shift(0.85f * colorShift), colorRoot.Shift(-0.20f * colorShift) }
                    };
                case EditMouseState.MouseLeftDown:
                    return new ColorBlend()
                    {
                        Positions = new float[] { 0f, 1f },
                        Colors = new Color[] { colorRoot.Shift(-0.50f * colorShift), colorRoot.Shift(0.50f * colorShift) }
                    };
                case EditMouseState.None:
                case EditMouseState.Outside:
                default:
                    return new ColorBlend()
                    {
                        Positions = new float[] { 0f, 1f },
                        Colors = new Color[] { colorRoot.Shift(0.60f * colorShift), colorRoot.Shift(-0.40f * colorShift) }
                    };
            }
        }
        private static ColorBlend GetColorBlendProfessionalStyle(Color colorRoot, float colorShift, EditMouseState state)
        {
            switch (state)
            {
                case EditMouseState.OnControl:
                case EditMouseState.MouseRightDown:
                    return new ColorBlend()
                    {
                        Positions = new float[] { 0f, 0.33f, 1f },
                        Colors = new Color[] { colorRoot.Shift(0.85f * colorShift), colorRoot.Shift(0.25f * colorShift), colorRoot.Shift(-0.20f * colorShift) }
                    };
                case EditMouseState.MouseLeftDown:
                    return new ColorBlend()
                    {
                        Positions = new float[] { 0f, 0.40f, 1f },
                        Colors = new Color[] { colorRoot.Shift(-0.50f * colorShift), colorRoot.Shift(-0.10f * colorShift), colorRoot.Shift(0.50f * colorShift) }
                    };
                case EditMouseState.None:
                case EditMouseState.Outside:
                default:
                    return new ColorBlend()
                    {
                        Positions = new float[] { 0f, 0.33f, 1f },
                        Colors = new Color[] { colorRoot.Shift(0.60f * colorShift), colorRoot.Shift(0.10f * colorShift), colorRoot.Shift(-0.40f * colorShift) }
                    };
            }
        }
        private static ColorBlend GetColorBlendWinXpStyle(Color colorRoot, float colorShift, EditMouseState state)
        {
            switch (state)
            {
                case EditMouseState.OnControl:
                case EditMouseState.MouseRightDown:
                    return new ColorBlend()
                    {
                        Positions = new float[] { 0.0f, 0.5f, 0.5f, 1.0f },
                        Colors = new Color[] { colorRoot.Shift(colorShift), colorRoot.Shift(0.60f * colorShift), colorRoot.Shift(0.20f * colorShift), colorRoot.Shift(0.20f * colorShift) }
                    };
                case EditMouseState.MouseLeftDown:
                    return new ColorBlend()
                    {
                        Positions = new float[] { 0.0f, 0.45f, 0.45f, 1.0f },
                        Colors = new Color[] { colorRoot.Shift(colorShift), colorRoot.Shift(0.40f * colorShift), colorRoot.Shift(-0.20f * colorShift), colorRoot.Shift(-0.00f * colorShift) }
                    };
                case EditMouseState.None:
                case EditMouseState.Outside:
                default:
                    return new ColorBlend()
                    {
                        Positions = new float[] { 0.0f, 0.5f, 0.5f, 1.0f },
                        Colors = new Color[] { colorRoot.Shift(colorShift), colorRoot.Shift(0.40f * colorShift), colorRoot, colorRoot }
                    };
            }
        }
        private static ColorBlend GetColorBlendWin7Style(Color colorRoot, float colorShift, EditMouseState state)
        {
			switch (state)
			{
				case EditMouseState.OnControl:
				case EditMouseState.MouseRightDown:
					return new ColorBlend()
					{
						Positions = new float[] { 0.0f, 0.3f, 0.3f, 1.0f },
						Colors = new Color[] { colorRoot.Shift(colorShift), colorRoot.Shift(0.60f * colorShift), colorRoot.Shift(0.20f * colorShift), colorRoot.Shift(0.20f * colorShift) }
					};
				case EditMouseState.MouseLeftDown:
					return new ColorBlend()
					{
						Positions = new float[] { 0.0f, 0.25f, 0.25f, 1.0f },
						Colors = new Color[] { colorRoot.Shift(colorShift), colorRoot.Shift(0.40f * colorShift), colorRoot.Shift(-0.20f * colorShift), colorRoot.Shift(-0.00f * colorShift) }
					};
				case EditMouseState.None:
				case EditMouseState.Outside:
				default:
					return new ColorBlend()
					{
						Positions = new float[] { 0.0f, 0.3f, 0.3f, 1.0f },
						Colors = new Color[] { colorRoot.Shift(colorShift), colorRoot.Shift(0.40f * colorShift), colorRoot, colorRoot }
					};
			}
        }
        #endregion
    }
    #region Interface ICurrentRenderStyle
    /// <summary>
    /// Interface který předepisuje přítomnost property RenderStyle CurrentRenderStyle { get; }.
    /// </summary>
    public interface ICurrentRenderStyle
    {
        /// <summary>
        /// Aktuální RenderStyle tohoto controlu
        /// </summary>
        RenderStyle CurrentRenderStyle { get; }
    }
    #endregion
    #region Enum: RenderStyle, EditMouseState
    /// <summary>
    /// Druh renderování controlu
    /// </summary>
    public enum RenderStyle
    {
        /// <summary>
        /// Zděděný od předka.
        /// Pokud bude tento typ zadán pro konkrétní renderování, použije se renderer FlatStyle.
        /// </summary>
        Inherited,
        /// <summary>
        /// Jednoduchý barevný přechod
        /// </summary>
        FlatStyle,
        /// <summary>
        /// Jednoduchý barevný přechod reverzní k FlatStyle
        /// </summary>
        ProfessionalStyle,
		/// <summary>
		/// Styl Windows XP
		/// </summary>
        WinXpStyle,
		/// <summary>
		/// Styl Windows 7
		/// </summary>
        Win7Style,
        /// <summary>
        /// Horizontální button-header
        /// </summary>
        HorizontalHeader
    }
    /// <summary>
    /// Statický stav myši, nepostihuje změny stavu a ani přetahování obsahu myši.
    /// Dynamický stav myši je definován v enum MouseChangeState.
    /// </summary>
    public enum EditMouseState
    {
        /// <summary>
        /// Myš nikde není
        /// </summary>
        None = 0,
        /// <summary>
        /// Myš je mimo daný prvek
        /// </summary>
        Outside,
        /// <summary>
        /// Myš je nad daným prvkem
        /// </summary>
        OnControl,
        /// <summary>
        /// Myš je stisknutá (levé tlačítko) na daném prvku
        /// </summary>
        MouseLeftDown,
        /// <summary>
        /// Myš je stisknutá (pravé tlačítko) na daném prvku
        /// </summary>
        MouseRightDown,
        /// <summary>
        /// Myš právě nyní přesouvá objekt
        /// </summary>
        MouseDragMove,
        /// <summary>
        /// Myš právě nyní resizuje objekt
        /// </summary>
        MouseDragResize
    }
    #endregion
}
